package com.smile.menu;

import com.light.roller.BigMenu;
import com.light.roller.Launcher;
import com.light.roller.Roller;
import com.light.roller.Roller_1;
import com.light.roller.Roller_2;
import com.light.roller.Roller_S10;
import com.light.roller.Roller_S11;
import com.light.roller.Roller_S12;
import com.light.roller.Roller_S13;
import com.light.roller.Roller_S14;
import com.light.roller.Roller_S15;
import com.light.roller.Roller_S25;
import com.light.roller.Roller_S26;
import com.light.roller.Roller_S27;
import com.light.roller.Roller_S3;
import com.light.roller.Roller_S4;
import com.light.roller.Roller_S5;
import com.light.roller.Roller_S6;
import com.light.roller.Roller_S7;
import com.light.roller.Roller_S8;
import com.light.roller.Roller_S9;
import com.light.roller.Roller_T1;
import com.light.roller.Roller_T2;




public class RollerManager {

	private int bigStages = 2;
	
	private Roller[][] stages = new Roller[][]
	                            {
									new Roller[]
									    {
											null,null,null,null,null,
											null,null,null,null,null,
											null,null,null,null,null,
											null,null,null,null,null
									    },
									new Roller[]
									    {
											null,null,null,null,null,
											null,null,null,null,null,
											null,null,null,null,null,
											null,null,null,null,null
									    },
									new Roller[]
									    {
											null,null,null,null,null,
											null,null,null,null,null,
											null,null,null,null,null,
											null,null,null,null,null
									    }
	                            };
	
	private Class<?>[][] Rollers = new Class<?>[][]
                               {
									   new Class<?>[]
									         {//The big Stage
											 },
									   
									   new Class<?>[]
									         {//small stage in Big stage1
												Roller_T1.class,
												Roller_T2.class,
												Roller_T1.class,
												Roller_T2.class,
												Roller_1.class,
												Roller_2.class,
												Roller_S3.class,
												Roller_S4.class,
												Roller_S5.class,
												Roller_S6.class,
												Roller_S7.class,
												Roller_S8.class,
												Roller_S9.class,
												Roller_S10.class,
												Roller_S25.class,
												Roller_S26.class,
												Roller_S27.class,
									         },
									   new Class<?>[]
									         {//small stage in Big stage2
											   	Roller_S14.class,
											   	Roller_S15.class
									         }
								    
                               };
	
	
	public Class<?> getNextStage(Class<?> currentStage)
	{
		for(int i=0;i<bigStages;i++)
		{
			for(int j=0;j<stages[i].length;j++)
			{
				if(Rollers[i][j] == currentStage)
				{
					if(j==(Rollers[i].length-1))
					{
						if(i == bigStages-1)
						{
							return Launcher.class;
						}else
						{
							return Rollers[i+1][0];
						}
					}else
					{
						return Rollers[i][j+1];
					}
				}
			}
		}
		return BigMenu.class;
	}
	
	public Class<?>[] getStageList(int listNum)
	{
		return Rollers[listNum];
	}
	
	public void addToList(Roller addStage)
	{
		for(int i=0;i<this.bigStages;i++)
		{
			for(int j=0;j<stages[j].length;j++)
			{
				//if(stages[i][j]!=null)
				{
					//stages[i][j] = addStage;
				}
			}
		}
	}
}
